package com.rec.smile.ui;

import java.awt.Dimension;
import java.awt.HeadlessException;

import javax.swing.JFrame;

public class Sence extends JFrame {

	public Sence() throws HeadlessException {
		super("皇室战争");
		
		CrPanel crPanel = new CrPanel();
		setSize(crPanel.getWidth(), crPanel.getHeight());
		Dimension screenSize = getToolkit().getScreenSize();
		setLocation(screenSize.width/2  -  crPanel.getWidth()/2, screenSize.height/2 - crPanel.getHeight()/2);
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		add(crPanel);
		
		startThread(crPanel);
	}

	private void startThread(final CrPanel crPanel ) {
		new Thread(new Runnable() {
			
			public void run() {
				try {
					while(true){
						Thread.sleep(200);
						crPanel.start();
					}
				} catch (Exception e) {
				}
			}

		}).start();
	}
	
}
